<template>
  <div>
    <!-- 母婴 -->
    <section>
      <template v-if="goodsList.length == 0">
        <el-skeleton />
      </template>
      <div class="at-home" v-else>
        <div class="container">
          <div class="good-title">
            <div class="title-left">
              <h1>母婴</h1>
            </div>
            <div class="jujia">
              <a href="#"> T恤/polo/衬衫</a>
              <a href="#">儿童鞋</a>
              <a href="#">外套/套装</a>
              <a href="#">裤子/裙装</a>
              <a href="#">连体衣/礼盒</a>
              <a href="#">学步鞋</a>
            </div>
            <div class="title-right"><a href="">查看全部 ></a></div>
          </div>
          <div class="home-list">
            <div class="list-left">
              <img :src="goodsList[3].picture" alt="" />
              <div class="mask">
                <div class="mask-left">{{ goodsList[3].name }}馆</div>
                <div class="mask-right">{{ goodsList[3].saleInfo }}</div>
              </div>
            </div>
            <div class="list-right">
              <ul>
                <li v-for="good in babyList" :key="good.id">
                  <div class="item">
                    <img :src="good.picture" alt="" />
                    <div class="item-title">
                      <h3>{{ good.name }}</h3>
                      <p>{{ good.desc }}</p>
                      <span>￥{{ good.price }}</span>
                    </div>
                  </div>
                  <!-- 隐藏 -->
                  <div class="item-yc">
                    <div class="yc-title">
                      <div class="yc-top">找相似</div>
                      <div class="yc-bottom">发现更多宝贝</div>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  mounted() {
    this.$store.dispatch("getGoodsList");
  },
  computed: {
    ...mapState({
      goodsList: (state) => state.home.goodsList,
    }),
    babyList() {
      return this.goodsList[3].goods;
    },
  },
};
</script>

<style>
</style>